package com.suse.controller;

import com.suse.dto.EmployerDto;
import com.suse.pojo.Employer;
import com.suse.service.EmployerService;
import com.suse.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/employer")
public class EmployerController {
    @Autowired
    EmployerService service;

    @GetMapping("/add")
    public ResultVo add(Employer employer) {
        return service.add(employer);
    }

    @PostMapping("/update")
    public ResultVo update(@RequestBody Employer employer) {
        return service.update(employer);
    }

    @GetMapping("/del")
    public ResultVo del(int id) {
        return service.del(id);
    }

    @GetMapping("/query")
    public ResultVo query(EmployerDto dto) {
        return service.select(dto);
    }

    //登录
    @PostMapping("/login")
    public ResultVo login(@RequestBody Employer employer, HttpServletRequest request) {
        return service.login(employer, request);
    }
}
